package com.cloud.dict.web.controller;

import com.cloud.dict.service.DictionaryService;
import com.cloud.dict.web.query.DictionaryGroupResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class DictionaryController {

    @Autowired
    private DictionaryService dictionaryGroupService;

    @Autowired
    private RedisTemplate redisTemplate;
    /**
     * 获取所有字典
     *
     * @return
     */
    @GetMapping("/findGroup")
    public List<DictionaryGroupResponse> findGroup() {
        return dictionaryGroupService.findGroupList();
    }
    /**
     * 获取所有字典
     *
     * @return
     */
    @GetMapping("/findAll")
    public Map<String,String> findAll() {
        Map<String,String> entries = redisTemplate.opsForHash().entries("sex");
        return entries;
    }


}
